import { Application } from "egg";

export default (app: Application) => {
    const { router, controller } = app;
    // const checktoken = app.middleware.checktoken();
    // const checkopenid = app.middleware.checkopenid();


    // router.get('/api/user/coupon/new', checkopenid, controller.ctrlAction.userNewCoupon);

    router.get('/api/user/coupon/get/:code', controller.ctrlCoupon.user_create); // 增/改
    router.get("/api/user/coupon", controller.ctrlCoupon.user_get); // 查

    router.get("/api/user/coupon/use/:id", controller.ctrlCoupon.user_use); // 查

    // ------------------------------ admin优惠券
    router.post('/api/admin/coupon/create/:id', controller.ctrlCoupon.create); // 增/改
    router.post("/api/admin/coupon/del/:id", controller.ctrlCoupon.del); // 删
    router.get("/api/admin/coupon", controller.ctrlCoupon.get); // 查
    router.get("/api/admin/coupon/detail", controller.ctrlCoupon.detail); // 查

};
